clear 
close all


%% Import data

import_file_name_1 = 'mat_files\m2023_01_11_2_2D2_qw_n2_6Er_modfreq3_1040_scan_phase_delta_N_vs_phase_evol_36p25ms.mat';
import_file_name_2 = 'mat_files\m2023_01_16_1_2D2_qw_6Er_modfreq3_1040_phase_m1p0_delta_N_vs_phase_evol_36p25ms.mat';
import_file_name_3 = 'mat_files\m2023_01_15_1_2D2_qw_n2_6Er_modfreq3_980_scan_phase_delta_N_vs_phase_evol_36p25ms.mat';

data_U_3 = load(import_file_name_1);
data_U_3_phase_m1p0 = load(import_file_name_2);
data_U_m3 = load(import_file_name_3);

theta_data = data_U_m3.uniquefvals;
evolution_dur = '36.25';


%% Plot theory and data

diff_atom_num_U_3 = cat(1,data_U_3_phase_m1p0.diff_atom_num_new, data_U_3.diff_atom_num_new);
err_diff_atom_num_U_3 = cat(1,data_U_3_phase_m1p0.err_diff_atom_num_new, data_U_3.err_diff_atom_num_new);

diff_atom_num_U_m3 = data_U_m3.diff_atom_num_new;
err_diff_atom_num_U_m3 = data_U_m3.err_diff_atom_num_new;

figure
hold on 
err1 = errorbar(theta_data, diff_atom_num_U_3, err_diff_atom_num_U_3, ...
    'o', 'CapSize', 0, 'DisplayName', 'U/J = -2.83');
err2 = errorbar(theta_data, diff_atom_num_U_m3, err_diff_atom_num_U_m3, ...
    'o', 'CapSize', 0, 'DisplayName', 'U/J = 2.83');
hold off
xticks(-1:0.5:1)
xlabel('\theta (\pi)')
ylabel('\Delta n')
ylim([-0.8 0.8])
legend

